# -*- coding: utf-8 -*-
from wechatpy.enterprise  import WeChatClient
from wechatpy.session.redisstorage import RedisStorage
from redis import Redis
# from main.settings import REDIS_STORE_URL

class WeChatClientApi(object):
    def __init__(self,app_id,secret,redis_url):
        self.app_id = app_id
        self.secret = secret
        self.redis_url = redis_url
        
    def wechat_client(self):
        client = WeChatClient(self.app_id, self.secret)
        redis_client = Redis.from_url(self.redis_url)
        session_interface = RedisStorage(
            redis_client,
            prefix="wechatpy"
        )
        wechat_client = WeChatClient(
            self.app_id,
            self.secret,
            session=session_interface
        )

        return wechat_client

    # agent_id – 必填，企业应用的id，整型。可在应用的设置页面查看。
    # user_ids – 成员ID列表。
    # party_ids – 部门ID列表。
    # tag_ids – 标签ID列表。
    # msg (dict | None) – 发送消息的 dict 对象